home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Scripts / QED-ShowError < prev   
Text File  |  1991-08-31  |  2KB  |  105 lines

  1. /*
  2.  
  3. QED-ShowError
  4.  
  5. This Arexx program displays the errors generated by the PCQ Pascal
  6. compiler using the QED text editor.  It should be called as
  7. follows:
  8.  
  9.     QED-ShowError SourceFile OutputFile ErrorFile
  10.  
  11. QED-ShowError reads the errorfile, which must have been generated
  12. by PCQ Pascal in "quiet" mode.  It displays the first error
  13. in the appropriate source file (not necessarily the SourceFile),
  14. then erases the OutputFile and ErrorFile.
  15.  
  16. This file was designed to be an error handler for the PCQ make
  17. utility.  It might work for other purposes, but I'd be careful if
  18. I were you.
  19.  
  20. To use this program, you'll need to include the following line in
  21. your configuration file:
  22.  
  23.     CompilerError rx QED-ShowError \s \d \e
  24.  
  25. You'll also need QED and Arexx.  Arexx is, of course, a commercial
  26. program, and QED is a very good shareware text editor written by:
  27.  
  28.     Darren M. Greenwald
  29.     462 Devon Court
  30.     Downingtown, PA 19335
  31.     USA
  32.  
  33. */
  34.  
  35. /* Read the command line parameters */
  36.  
  37. parse arg SourceFileName OutputFileName ErrorFileName .
  38.  
  39. options results
  40.  
  41.  
  42. /* Get the first error */
  43.  
  44. if open(logfile, ErrorFileName, 'R') then do
  45.  
  46.     if eof(logfile) then do   /* There were no errors */
  47.     FileName = SourceFileName
  48.     LineNo = 1
  49.     ColumnNo = 1
  50.     ErrorText = "No Errors"
  51.     end; else do
  52.         ErrorString = readln(logfile)
  53.  
  54.         /* This first test is just a reminder, in case you want to */
  55.         /* process all errors.  "Abort" would never come first.    */
  56.  
  57.         if ErrorString = "Compilation Aborted" then do
  58.             address command 'delete >nil:' outputfile
  59.             'okay1 Compilation Aborted'
  60.             exit
  61.         end
  62.  
  63.         if ErrorString ~= "" then do
  64.             parse var ErrorString '"' FileName '" At ' LineNo,
  65.                                        ',' ColumnNo ' :' ErrorText
  66.     end; else do
  67.         FileName = SourceFileName
  68.         LineNo = 1
  69.         ColumnNo = 1
  70.         ErrorText = "No Errors"
  71.     end
  72.     end
  73.     close(logfile)
  74. end; else do
  75.     say 'Could not open error file'
  76.     exit
  77. end
  78.  
  79. /* Load QED */
  80.  
  81. if ~show(Ports,'QED_REXX') then do
  82.     address command 'RUN QED -PQED_REXX'
  83.     do until show(Ports,'QED_REXX')
  84.     address command wait 1
  85.     end
  86. end
  87.  
  88. address 'QED_REXX'
  89.  
  90. loadfile FileName
  91.  
  92. 'GOTO' LineNo         /* Move to the correct line */
  93. 'BOL'                 /* Make sure we're at the beginning */
  94. do for ColumnNo
  95.     'CRRIGHT'
  96. end
  97.  
  98. 'MESSAGE Error:' || ErrorText
  99.  
  100. /* Delete the temporary files */
  101.  
  102. address command 'delete >Nil:' ErrorFileName
  103. address command 'delete >Nil:' OutputFileName
  104.  
  105.